package com.tuliyou.common.util;

import com.tuliyou.entity.User;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserHolder {
    private static final ThreadLocal<User> tl = new ThreadLocal<>();

    public static void saveUser(User user) {
        tl.set(user);
    }

    public static User getUser(){
        return tl.get();
    }

    public static void removeUser(){
        log.info("执行了移除操作");
        tl.remove();
    }
}
